package blackhouse_server;

import java.sql.SQLException;
import java.util.List;

import blackhouse_dao.result_dao;
import blackhouse_entity.result;

public class classcj_check2_server
{
	public List<result> readyresult(String ID, int subcode) throws SQLException
	{
		result_dao RS = new result_dao();
		String sql = "SELECT classID FROM student WHERE stuCode='" + ID + "'";
		int classid = RS.seeclassid(sql);
		sql = "SELECT gradeName,className,stuCode,stuName,subjectName,result  FROM result a INNER JOIN student b ON a.`sid` = b.`id`   INNER JOIN SUBJECT c ON a.`subid` = c.`id`  INNER JOIN classtable d ON b.`classid`  = d.`id` INNER JOIN grade e ON e.`id` = d.`gradeID` where b.`classid`="
				+ classid;
		if (subcode != 0)
		{
			sql = "SELECT gradeName,className,stuCode,stuName,subjectName,result  FROM result a INNER JOIN student b ON a.`sid` = b.`id`   INNER JOIN SUBJECT c ON a.`subid` = c.`id`  INNER JOIN classtable d ON b.`classid` = d.`id` INNER JOIN grade e ON e.`id` = d.`gradeID` where b.`classid`="
					+ classid + " and a.`subid`=" + subcode;
		}
		return RS.readyresult(sql);
	}
}
